package com.company;

public class Test28数值移位 {
    public static void main(String[] args) {
        int a[]=yiwei(123456789,2,7);
        for (int i=0;i<a.length;i++){
            System.out.println(a[i]);
        }
    }

    public static int[] yiwei(int x,int m,int n){
        int ans[]=new int[n-m+1];
        for (int i=1,j=0;j<ans.length&&x>0;i++){
            if(i>=m&&i<=n){
                ans[j]=x%10;
                j++;
            }
            x=x/10;
        }
        return ans;
    }
}
